package qdu.edu.com.fushanf4.service.clean.item;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Mapper;
import qdu.edu.com.fushanf4.utils.UtilConstants;

import java.io.IOException;

public class SplitItemDescriptionMapper extends Mapper<LongWritable, Text, NullWritable,Text> {
    private final Text valueOut = new Text();

    @Override
    protected void map(LongWritable key,Text value,Context context) throws IOException,InterruptedException{
       String line =value .toString();
       String[] lines =line.split(UtilConstants.RegexOfString.HORIZONTAL_TABULATION);
       if (lines.length == 2) {
           valueOut.set(lines[1]);
           context.write(NullWritable.get(),valueOut);
       }
    }
}
